import 'package:flutter/material.dart';

class MsgList extends StatefulWidget {
  MsgList({Key key}) : super(key: key);

  _MsgListState createState() => _MsgListState();
}

class _MsgListState extends State<MsgList> {
  @override
  void initState() {
    super.initState();
  }

  @override
  void dispose() {
    super.dispose();
  }

  @override
  Widget build(BuildContext context) {
    return DefaultTabController(
      length: 2, //项的数量
      initialIndex: 0, //默认选择第一项
      child: Scaffold(
        backgroundColor: Color.fromRGBO(240, 240, 245, 1),
        appBar: AppBar(
          automaticallyImplyLeading: false,
          title: Container(
            alignment: Alignment.topLeft,
            // color: Colors.red,
            child: TabBar(
              tabs: [
                Tab(text: '好友'),
                Tab(text: '心动'),
              ],
              indicatorWeight: 2,
              indicatorPadding: EdgeInsets.only(left: 10, right: 10),
              labelPadding: EdgeInsets.symmetric(horizontal: 10),
              isScrollable: true,
              indicatorColor: Color(0xffFF7E98),
              labelColor: Color(0xffFF7E98),
              labelStyle: TextStyle(
                color: Color(0xffFF7E98),
                fontWeight: FontWeight.w500,
              ),
              unselectedLabelColor: Color(0xffAAAAAA),
              unselectedLabelStyle: TextStyle(color: Color(0xffAAAAAA)),
              indicatorSize: TabBarIndicatorSize.label,
            ),
          ),
          backgroundColor: Colors.white,
          elevation: 0,
        ),
        body: new TabBarView(
          children: <Widget>[
            Text('msgdeal'),
            Text('msgsystem'),
          ],
        ),
      ),
    );
  }
}
